home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy: Best of 1985
/
Ahoy_Best_of_1985_1986_Double_L.d64
/
futurewar f'85
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
12KB
|
345 lines
2 v=53280:w=54272:sm=1024:cm=55296:pokev,11:pokev+1,0:print"[147]"
4 print"";tab(9);"*****[146] futurewar! *****"
6 printtab(13);"by b.w.behling"
8 printtab(11);"(c) copyright 1984"
10 gosub 12:gosub 22:goto 56
12 rem ** variables **
14 dimpn$(2,6),p(2,6),se(9,4,6),d%(12):tr=36
16 fori=1to6:readcl$:pn$(1,i)=cl$:readcl$:pn$(2,i)=cl$:nexti
18 fori=1to9:reada%(i):next:fori=2to9:readb%(i):next:fori=0to9:readc%(i):next
20 return
22 rem ** delay loop **
24 fordl=0to2000:nextdl:return
26 rem ** print message **
28 print"";msg$:gosub 22:return
30 rem ** erase message **
32 forer=1824to2023:pokeer,32:nexter:return
34 rem ** player info **
36 print"";pn$(0,pt);",";msg$:return
38 rem ** bomb sound **
40 fori=0to22:pokew+i,0:nexti:pokew+24,10:pokew+5,80:pokew+12,160
42 pokew+6,255:pokew+13,252:pokew+4,17:pokew+4,16
44 fori=255to200step-1:poke54273,i:nexti
46 fori=255to75step-1:poke54273,i
48 forj=1to5:next:next:pokew+1,10:pokew+8,1:pokew+5,112:pokew+6,252
50 pokew+4,129:pokew+11,129
52 fori=1to200:nexti
54 pokew+4,128:pokew+11,128:return
56 print"[147] number of players";:inputnp
58 ifnp<7then 62
60 print" sorry, no more than six can play!":gosub 22:goto 56
62 ifnp<1then 56
64 ifnp<3ornp>5then 68
66 print" can i play with you";:inputcp$:goto 70
68 cp=0:goto 74
70 ifleft$(cp$,1)="n"thencp=0:goto 74
72 cp=1
74 fori=1tonp
76 print" player #";i;:input"name";pn$(0,i)
78 iflen(pn$(0,i))<11then 84
80 print"[158] that name is too large!"
82 print" no more than 10 letters please.":goto 76
84 print" ";pn$(0,i);",your color is ";pn$(1,i);".":nexti
86 onnpgoto 90, 104
88 goto 112
90 print" player # 2 name? computer 2"
92 pn$(0,2)="computer 2":p(2,2)=1
94 print" ";pn$(0,2);",your color is ";pn$(1,2);".":i=3
96 print" player # 3 name? computer 3"
98 pn$(0,3)="computer 3":p(2,3)=1
100 print" ";pn$(0,3);",your color is ";pn$(1,3);"."
102 np=3:goto 120
104 print" player # 3 name? computer 3"
106 pn$(0,3)="computer 3":p(2,3)=1
108 print" ";pn$(0,3);",your color is ";pn$(1,3);"."
110 np=3:goto 120
112 ifcp<>1then 120
114 np=np+1:print" player #";np;"name? computer";np
116 pn$(0,np)="computer"+str$(np)
118 print" ";pn$(0,np);",your color is ";pn$(1,np);".":p(2,np)=1
120 gosub 22:gosub 22
122 ar=32-((np-3)*5):pt=int(np*rnd(0))+1
124 fori=1to6:p(1,i)=ar:nexti
126 rem ** draw screen **
128 print"[147]":fori=0to40:reads:pokesm+i,s+128:pokecm+i,7:nexti
130 fori=79to759step40:pokesm+i,160:pokecm+i,7
132 pokesm+i+1,160:pokecm+i+1,7:nexti
134 fori=761to799:reads:pokesm+i,s+128:pokecm+i,7:nexti
136 fori=1to4:printtab(1)" [206][163][163][205] [206][163][163][205] [206][163][163][205] [206][163][163][205] [206][163][163][205]"
138 printtab(1)"[206] [205][164][164][206] [205][164][164][206] [205][164][164][206] [205][164][164][206] [205]"
140 printtab(1)"[205] [206][163][163][205] [206][163][163][205] [206][163][163][205] [206][163][163][205] [206]"
142 printtab(1)" [205][164][164][206] [205][164][164][206] [205][164][164][206] [205][164][164][206] [205][164][164][206]":nexti
144 printtab(5)"[205] [206] [205] [206] [205] [206] [205] [206]"
146 printtab(6)"[205][164][164][206] [205][164][164][206] [205][164][164][206] [205][164][164][206]"
148 msg$=" now we choose sectors [146]":gosub 26:gosub 30
150 r1=int(9*rnd(0))+1:r2=4:r3=int(9*rnd(0))+1:r4=1
152 rem ** picking sectors **
154 msg$=" pick a sector.":gosub 34
156 ifp(2,pt)=1then 180
158 print"enter #";:inputpi$:iflen(pi$)<>2thengosub 30:goto 154
160 ifasc(left$(pi$,1))<49 or asc(left$(pi$,1))>57thengosub 30:goto 154
162 ifasc(right$(pi$,1))<49 or asc(right$(pi$,1))>52thengosub 30:goto 154
164 a=val(left$(pi$,1)):b=val(right$(pi$,1))
166 ifse(a,b,0)=0thense(a,b,pt)=1:se(a,b,0)=1:p(1,pt)=p(1,pt)-1:goto 172
168 msg$=" already picked [146]"
170 gosub 26:gosub 30:goto 154
172 gosub 246:tr=tr-1:pt=pt+1:ifpt>nptthenpt=1
174 iftr>0then 154
176 msg$=" all sectors occupied [146]":gosub 26:gosub 30
178 msg$=" now you must reinforce [146]":gosub 26:gosub 30:goto 208
180 rem ** comp. terr. pick **
182 print"enter #?";
184 ifpt=2then 196
186 ifse(r3,r4,0)=0then 194
188 r4=r4+1:ifr4>4thenr4=1:r3=r3+1
190 ifr3>9thenr3=1
192 goto 186
194 a=r3:b=r4:z=r3*10+r4:goto 206
196 ifse(r1,r2,0)=0then 204
198 r2=r2-1:ifr2<1thenr2=4:r1=r1-1
200 ifr1<1thenr1=9
202 goto 196
204 a=r1:b=r2:z=r1*10+r2
206 pi$=str$(z):printpi$:gosub 22:goto 166
208 rem ** initial reinforceing **
210 msg$="":gosub 34:print"you have";p(1,pt);"armies left"
212 ifp(2,pt)=1then 234
214 input"reinforce #";fo$:iflen(fo$)<>2thengosub 30:goto 210
216 ifasc(left$(fo$,1))<49 or asc(left$(fo$,1))>57thengosub 30:goto 210
218 ifasc(right$(fo$,1))<49 or asc(right$(fo$,1))>52thengosub 30:goto 210
220 a=val(left$(fo$,1)):b=val(right$(fo$,1))
222 ifse(a,b,pt)=1thense(a,b,0)=se(a,b,0)+1:p(1,pt)=p(1,pt)-1:goto 228
224 msg$=" not your sector! [146]"
226 gosub 26:gosub 30:goto 210
228 gosub 246:pt=pt+1:ifpt>nptthenpt=1
230 ifp(1,pt)>0then 210
232 msg$=" prepare for battle!! [146]":gosub 26:gosub 30:goto 274
234 rem ** computer reinforcing **
236 print"reinforce #?";
238 ra=int(9*rnd(0))+1:rb=int(4*rnd(0))+1
240 forpc=rbto4:ifse(ra,pc,pt)<>1thennextpc:goto 238
242 a=ra:b=pc:pc=ra*10+pc
244 pi$=str$(pc):printpi$:gosub 22:goto 222
246 rem ** update sectors **
248 ta=-2:fori=1toa:ta=ta+4:nexti
250 print"":ifa/2=int(a/2)then 262
252 onbgoto 254, 256, 258, 260
254 printtab(ta);"";pn$(2,pt):goto 272
256 printtab(ta);"";pn$(2,pt):goto 272
258 printtab(ta);"";pn$(2,pt):goto 272
260 printtab(ta);"";pn$(2,pt):goto 272
262 onbgoto 264, 266, 268, 270
264 printtab(ta);"";pn$(2,pt):goto 272
266 printtab(ta);"";pn$(2,pt):goto 272
268 printtab(ta);"";pn$(2,pt):goto 272
270 printtab(ta);"";pn$(2,pt)
272 printtab(ta);" [145]":printtab(ta);se(a,b,0):gosub 30:return
274 rem ** main routine **
276 am=0:ea%=0:ea=0:forx=1to9:fory=1to4:ifse(x,y,pt)=1thenam=am+.75:ea=ea+2
278 nexty:ifea=8thenea%=ea%+ea
280 ea=0:nextx:ifam>0then 286
282 pt=pt+1:ifpt>npthenpt=1
284 goto 274
286 ifam<3thenam=3
288 p(1,pt)=int(am):ab=rnd(0)*.5:p(1,pt)=int(p(1,pt)+(ab*p(1,pt)))+ea%
290 msg$="":gosub 34:print"you have";p(1,pt);"armies to station"
292 ifp(2,pt)=1then 590
294 input"what sector #";ri$:iflen(ri$)<>2thengosub 30:goto 290
296 ifasc(left$(ri$,1))<49 or asc(left$(ri$,1))>57thengosub 30:goto 290
298 ifasc(right$(ri$,1))<49 or asc(right$(ri$,1))>52thengosub 30:goto 290
300 a=val(left$(ri$,1)):b=val(right$(ri$,1))
302 ifse(a,b,pt)=1then 308
304 msg$=" not your sector! [146]"
306 gosub 26:gosub 30:goto 290
308 print"[145] ":input"[145]how many";st%
310 ifst%<=p(1,pt)thense(a,b,0)=se(a,b,0)+st%:p(1,pt)=p(1,pt)-st%:goto 316
312 msg$=" you don't have that many! [146]"
314 gosub 26:gosub 30:goto 290
316 gosub 246:ifp(1,pt)<>0then 290
318 msg$=" all troops on station! [146]":gosub 26:gosub 30
320 msg$="do you want to attack? [y/n]":gosub 30:gosub 34
322 ifp(2,pt)=1then 510
324 getk$:ifk$=""then 324
326 ifk$="n"then 450
328 input"attack what sector";ds$
330 iflen(ds$)<>2thengosub 30:goto 320
332 ifasc(left$(ds$,1))<49 or asc(left$(ds$,1))>57thengosub 30:goto 320
334 ifasc(right$(ds$,1))<49 or asc(right$(ds$,1))>52thengosub 30:goto 320
336 ad=val(left$(ds$,1)):bd=val(right$(ds$,1))
338 ifse(ad,bd,pt)=0then 344
340 msg$=" that's one of your sectors! [146]"
342 gosub 26:gosub 30:goto 320
344 input"from";as$
346 iflen(as$)<>2thengosub 30:goto 320
348 ifasc(left$(as$,1))<49 or asc(left$(as$,1))>57thengosub 30:goto 320
350 ifasc(right$(as$,1))<49 or asc(right$(as$,1))>52thengosub 30:goto 320
352 aa=val(left$(as$,1)):ba=val(right$(as$,1))
354 ifse(aa,ba,pt)=1then 360
356 msg$=" that's not one of your sectors! [146]"
358 gosub 26:gosub 30:goto 320
360 ifse(aa,ba,0)>1then 366
362 msg$=" not enough armies for this attack [146]"
364 gosub 26:gosub 30:goto 320
366 ifaa=ad and ba=bd+1 or aa=ad and ba=bd-1then 382
368 ifaa<>ad-1 and aa<>ad+1then 378
370 ifad/2=int(ad/2)then 376
372 ifba=bd or ba=bd-1then 382
374 goto 378
376 ifba=bd or ba=bd+1then 382
378 msg$=" sectors do not connect [146]"
380 gosub 26:gosub 30:goto 320
382 ifse(aa,ba,0)-1=1thenas%=1:goto 388
384 msg$="":gosub 30:gosub 34:print"attacking strength [1 -";se(aa,ba,0)-1;
386 print"[157]]";:inputas%:ifas%<1then 382
388 ifas%>se(aa,ba,0)-1then 382
390 al=0:dl=0:forat=1toas%:a1=int(6*rnd(0))+1:d1=int(6*rnd(0))+1
392 al=al+1:ifa1>d1thenal=al-1:dl=dl+1
394 ifse(ad,bd,0)-dl<1then 400
396 ifse(aa,ba,0)-al<2then 402
398 nextat:goto 402
400 ifas%=>se(aa,ba,0)-althenas%=se(aa,ba,0)-(al+1)
402 a=aa:b=ba:gosub 30:gosub 38:se(a,b,0)=se(a,b,0)-al:gosub 246
404 a=ad:b=bd:se(a,b,0)=se(a,b,0)-dl:tp=pt
406 fors=1to6:ifse(a,b,s)=1thenpt=s:gosub 246
408 nexts:pt=tp:ifse(a,b,0)<1then 422
410 ifse(aa,ba,0)<2thenpokew+24,0:goto 320
412 msg$=" same attack again? [y/n]":pokew+24,0:gosub 30:gosub 34
414 ifp(2,pt)=1then 580
416 getk$:ifk$=""then 416
418 ifk$="y"thengosub 30:goto 382
420 goto 320
422 msg$=" sector conquered [146]":pokew+24,0:gosub 26:gosub 30
424 fors=1to6:se(a,b,s)=0:nexts:se(a,b,pt)=1
426 forx=1to9:fory=1to4:ifse(x,y,pt)=1thentt=tt+1
428 nexty:nextx:iftt<>36thentt=0
430 ifas%=se(aa,ba,0)-1thenoa%=as%:goto 442
432 msg$="":gosub 34:print"you must move in";as%;"armies minimum"
434 ifp(2,pt)=1then 584
436 input"how many";oa$:forc=1tolen(oa$):c$=mid$(oa$,c,1)
438 ifasc(c$)<49orasc(c$)>57then 432
440 nextc:oa%=val(oa$)
442 ifoa%<as% or oa%>se(aa,ba,0)-1then 432
444 se(a,b,0)=oa%:gosub 246:a=aa:b=ba:se(a,b,0)=se(a,b,0)-oa%:gosub 246
446 iftt=36then 650
448 goto 320
450 msg$=" move troops? [y/n]":gosub 30:gosub 34
452 ifp(2,pt)=1thenk$="n":printtab(31);"[145]n":gosub 22:goto 456
454 getk$:ifk$=""then 454
456 ifk$="n"thengosub 30:goto 506
458 input"move from";mf$
460 iflen(mf$)<>2then 450
462 ifasc(left$(mf$,1))<49 or asc(left$(mf$,1))>57then 450
464 ifasc(right$(mf$,1))<49 or asc(right$(mf$,1))>52then 450
466 af=val(left$(mf$,1)):bf=val(right$(mf$,1))
468 ifse(af,bf,pt)=1then 474
470 msg$=" that's not one of your sectors! [146]"
472 gosub 26:goto 450
474 input"move to";mt$
476 iflen(mt$)<>2then 450
478 ifasc(left$(mt$,1))<49 or asc(left$(mt$,1))>57then 450
480 ifasc(right$(mt$,1))<49 or asc(right$(mt$,1))>52then 450
482 at=val(left$(mt$,1)):bt=val(right$(mt$,1))
484 ifse(at,bt,pt)<>1then 470
486 ifaf=at and bf=bt+1 or bf=bt-1then 498
488 ifaf<>at-1 and af<>at+1then 496
490 ifat/2=int(at/2)then 494
492 ifbf=bt or bf=bt-1then 498
494 ifbf=bt or bf=bt+1then 498
496 msg$=" sectors do not connect [146]":gosub 26:goto 450
498 msg$="":gosub 30:gosub 34:input"how many";tm%
500 iftm%>se(af,bf,0)-1then 498
502 se(af,bf,0)=se(af,bf,0)-tm%:se(at,bt,0)=se(at,bt,0)+tm%
504 a=af:b=bf:gosub 246:a=at:b=bt:gosub 246
506 pt=pt+1:ifpt>npthenpt=1
508 goto 274
510 rem ** computer main routine **
512 z%=int(rnd(0)*100)+1:ifz%<90then 516
514 gosub 22:goto 450
516 ra%=int(9*rnd(0))+1
518 forra=1to9:ra%=ra%+1:ifra%>9thenra%=1
520 forrb=1to4:ifse(ra%,rb,pt)=1thennextrb:nextra:goto 514
522 ad=ra%:bd=rb:ds=ad*10+bd:ds$=str$(ds)
524 ifbd=1then 530
526 aa=ad:ba=bd-1:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
528 ifbd=4then 532
530 aa=ad:ba=bd+1:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
532 ifad=1then 538
534 aa=ad-1:ba=bd:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
536 ifad=9then 540
538 aa=ad+1:ba=bd:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
540 ifad/2<>int(ad/2)then 550
542 ifbd=4then 560
544 aa=ad-1:ba=bd+1:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
546 aa=ad+1:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
548 nextrb:nextra:goto 514
550 ifbd=1then 560
552 ifad=1then 558
554 aa=ad-1:ba=bd-1:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
556 ifad=9then 560
558 aa=ad+1:ba=bd-1:ifse(aa,ba,pt)=1 and se(aa,ba,0)>2then 562
560 nextrb:nextra:goto 514
562 ifse(aa,ba,0)<se(ad,bd,0)/2thennextrb:nextra:goto 514
564 print"attack what sector?";
566 as=aa*10+ba:as$=str$(as)
568 printds$:gosub 22:print"from?";as$:gosub 22
570 as%=int(rnd(0)*(se(aa,ba,0)-1))+1
572 ifse(aa,ba,0)-1=1then 390
574 ifse(aa,ba,0)-1>se(ad,bd,0)andas%<int(se(ad,bd,0)/1.5)then 570
576 msg$="":gosub 30:gosub 34:print"attacking strength [1 -";se(aa,ba,0)-1;
578 print"[157]]?";as%:gosub 22:goto 390
580 ifse(aa,ba,0)>se(ad,bd,0)/2then 570
582 goto 320
584 oa%=int(rnd(0)*se(aa,ba,0))
586 ifoa%<as%then 584
588 print"how many?";oa%:gosub 22:goto 442
590 rem *** computer station ***
592 print"what sector #?";
594 ra=int(9*rnd(0))+1:rb=int(4*rnd(0))+1
596 ifse(ra,rb,pt)=1then 594
598 ad=ra:bd=rb
600 ifbd=1then 606
602 aa=ad:ba=bd-1:ifse(aa,ba,pt)=1then 638
604 ifbd=4then 608
606 aa=ad:ba=bd+1:ifse(aa,ba,pt)=1then 638
608 ifad=1then 614
610 aa=ad-1:ba=bd:ifse(aa,ba,pt)=1then 638
612 ifad=9then 616
614 aa=ad+1:ba=bd:ifse(aa,ba,pt)=1then 638
616 ifad/2<>int(ad/2)then 626
618 ifbd=4then 636
620 aa=ad-1:ba=bd+1:ifse(aa,ba,pt)=1then 638
622 aa=ad+1:ifse(aa,ba,pt)=1then 638
624 goto 594
626 ifbd=1then 636
628 ifad=1then 634
630 aa=ad-1:ba=bd-1:ifse(aa,ba,pt)=1then 638
632 ifad=9then 636
634 aa=ad+1:ba=bd-1:ifse(aa,ba,pt)=1then 638
636 goto 594
638 a=aa:b=ba:z=aa*10+ba
640 ri$=str$(z):printri$:gosub 22
642 print"[145] ":print"[145]how many?";
644 st%=int(rnd(0)*p(1,pt))+1:ifst%<10then 648
646 ifst%>p(1,pt)/5thenst%=int(p(1,pt)/5):ifst%<1thenst%=1
648 printst%:gosub 22:goto 310
650 rem ** game over **
652 ifp(2,pt)=1then 670
654 msg$=" ********** you won! **********[146]"
656 gosub 30:gosub 26
658 pokev,14:pokev+1,6:print"[147]* * * * * * [146]"
660 fori=1to3:printtab(7);" * * * * * [146]"
662 printtab(7);"* * * * * * [146]":nexti
664 fori=1to3:printtab(7);" [146]"
666 printtab(7);" [146]":nexti
668 msg$=" you are a true champion!!":gosub 34:end
670 msg$=" you humans are so easy to beat! [146]"
672 gosub 30:gosub 26:end
674 rem ** data starts **
676 data"white[146]","pl#1[146]","red[146]","pl#2[146]","[154]blue[146]","[154]pl#3[146]","[158]yellow[146]"
678 data"[158]pl#4[146]","[156]purple[146]","[156]pl#5[146]","green[146]","pl#6[146]"
680 data1,2,3,4,5,6,7,8,9,15,13,4,14,6,7,8,9,10,11,12,13,4,14,6,7,8,9
682 data32,32,32,49,49,32,32,50,49,32,32,51,49,32,32,52,49,32,32,53,49,32,32
684 data54,49,32,32,55,49,32,32,56,49,32,32,57,49,32,32,32,32
686 data32,32,49,52,32,32,50,52,32,32,51,52,32,32,52,52,32,32,53,52,32,32
688 data54,52,32,32,55,52,32,32,56,52,32,32,57,52,32,32,32